﻿#include "EditorFPSStatusViewModel.h"
#include "EditorFPSStatusModel.h"


void REditorFPSStatusViewModel::BindModel(TSharedObjectPtr<REditorStatusItemModel> InModel)
{
    Super::BindModel(InModel);
    FPSModel=InModel;
}

CString REditorFPSStatusViewModel::GetFPS() const
{
    return FPS;
}

void REditorFPSStatusViewModel::Tick(float DeltaSeconds)
{
    PastTime+=DeltaSeconds;
    const float Interval=0.5f;
    if (PastTime>Interval)
    {
        PastTime-=int(PastTime/Interval)*Interval;
        FPS=CString(U"逻辑帧率：")+CString(FPSModel->GetLogicFPS(),1)
            +U"渲染帧率："+CString(FPSModel->GetRenderFPS(),1);
    }
}
